package com.orange.core.mapper.coupon;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.orange.core.pojo.entity.coupon.Coupon;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface CouponMapper extends BaseMapper<Coupon> {

    @Update("update coupon set stock = stock - #{stock} where id = #{id} and stock >= #{stock}")
    boolean deductStock(@Param("id") Integer id, @Param("stock") Integer stock);
}
